home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #2 / Amiga Plus CD - 1995 - No. 2.iso / internet / faq / englisch / internationalization-programm < prev    next >
Encoding:
Text File  |  1995-04-11  |  26.6 KB  |  665 lines

  1.  
  2. Archive-name: internationalization/programming-faq
  3. Posting-Frequency: monthly
  4. Version: 1.7
  5.  
  6.  
  7.           Programming for Internationalization
  8.  
  9.  
  10.  
  11. DISCLAIMER: THE AUTHOR MAKES NO WARRANTY OF ANY KIND WITH REGARD TO
  12. THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  13. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15. Note: Most of this was tested on a Sun 10, running SunOS 4.1.* - other
  16. systems might differ slightly
  17.  
  18. This FAQ discusses topics related to internationalization. Simple i18n
  19. support for Europe, Latin America, and the Middle East might use of
  20. the ISO 8859-X based 8 bit character sets.  For wider portability, a
  21. standard such as Unicode is in order.
  22.  
  23. This FAQ discusses how to program applications which support the use
  24. European (Latin American) national character sets on UNIX-based
  25. systems and standard C environments, and discusses some choices with
  26. respect to character sets.
  27.  
  28.  
  29. INTRODUCTION 
  30.  
  31. Most of the information given here is independent of the character
  32. encoding used (e.g. DEC MCS, ISO Latin-X, etc.), but can be applied to
  33. any character set, providing the programming environment has
  34. provisions for this standard.
  35.  
  36.  
  37. 1. Which coding should I use for accented characters?
  38. Use the internationally standardized ISO-8859-1 character set to type
  39. accented characters. This character set contains all characters
  40. necessary to type (West) European languages. This encoding is also the
  41. preferred encoding on the Internet.  ISO 8859-X character sets use the
  42. characters 0xa0 through 0xff to represent national characters, while
  43. the characters in the 0x20-0x7f range are those used in the US-ASCII
  44. (ISO 646) character set.  Thus, ASCII text is a proper subset of all
  45. ISO 8859-X character sets.  
  46.  
  47. The characters 0x80 through 0x9f are earmarked as extended control
  48. chracters, and are not used for encoding characters.  These characters
  49. are not currently used to specify anything.  A practical reason for
  50. this is interoperability with 7 bit devices (or when the 8th bit gets
  51. stripped by faulty software).  Devices would then interpret the character
  52. as some control character and put the device in an undefined state.
  53. (When the 8th bit gets stripped from the characters at 0xa0 to 0xff, a
  54. wrong character is represented, but this cannot change the state of a
  55. terminal or other device.)
  56.  
  57. This character set is also used by AmigaDOS, MS-Windows, VMS (DEC MCS
  58. is practically equivalent to ISO 8859-1) and (practically all) UNIX
  59. implementations.  MS-DOS normally uses a different character set and
  60. is not compatible with this character set. (It can, however, be
  61. translated to this format with various tools. See section 5.)
  62.  
  63. Footnote: Supposedly, IBM code page 819 is fully ISO 8859-1 compliant.
  64.  
  65.  
  66. ISO 8859-1 supports the following languages:
  67. Afrikaans, Basque, Catalan, Danish, Dutch, English, Faeroese, Finnish,
  68. French, Galician, German, Icelandic, Irish, Italian, Norwegian,
  69. Portuguese, Spanish and Swedish.
  70.  
  71. (It has been called to my attention that Albanian can be written with
  72. ISO 8859-1 also.  However, from a standards point of view, ISO 8859-2
  73. is the appropriate character set for Balkan countries.)
  74.  
  75. ISO 8859-1 is just one part of the ISO-8859 standard, which specifies
  76. several character sets:
  77. 8859-1    Europe, Latin America
  78. 8859-2  Eastern Europe
  79. 8859-3  SE Europe/miscellaneous (Esperanto, Maltese, etc.) 
  80. 8859-4  Scandinavia/Baltic (mostly covered by 8859-1 also)
  81. 8859-5  Cyrillic
  82. 8859-6  Arabic
  83. 8859-7  Greek 
  84. 8859-8  Hebrew
  85. 8859-9  Latin5, same as 8859-1 except for Turkish instead of Icelandic
  86. 8859-10 Latin6, for Lappish/Nordic/Eskimo languages
  87.  
  88. Another nascent standard is UNICODE (ISO 10646).  UNICODE is an
  89. extension of ISO 8859-1 (which itself is an extension of US-ASCII) to
  90. wide characters.  Thus, most of the world's languages (including
  91. Japanese, Korean, Chinese...) can be covered.
  92.  
  93. Unicode is advantageous because one character set suffices to encode
  94. all the world's languages, however very few programs (and even fewer
  95. operating systems) support wide characters. Thus, a `cheap' upgrade
  96. from 7 bit US-ASCII might be to only 8 bit wide character sets (such
  97. as the ISO 8859-X).  Unfortunately, some programmers still insist on
  98. using the `spare' eigth bit for clever tricks, which will make
  99. conversion more difficult.
  100.  
  101.  
  102. Footnote: Some people have complained about missing characters,
  103.           e.g. French users about a missing 'oe'.  Note that oe is 
  104.           not a character, but a ligature (a combination of two
  105.           characters for typographical purposes).  Ligatures are not 
  106.           part of the ISO 8859-X standard.  (Although 'oe' used to 
  107.           be in the draft 8859-1 standard before it was unmasked as
  108.           `mere' ligature.)
  109.  
  110.  
  111.  
  112.  
  113. 2. Choosing the character set encoding
  114.  
  115. Depending on your needs, you will probably want to choose different
  116. solutions.  A quick shot i18n of US programs might simply be going to
  117. 8 bit and use one of the ISO 8859-X character sets.
  118.  
  119. If you have a choice and start from scratch, you might want to
  120. consider Unicode.  There are several aspects to choosing a particular
  121. character set (and you may want to decide on different character sets
  122. for different purposes):
  123. 1) what codeset should the application run in?  
  124. 2) what codeset should files be saved in 
  125. 3) what codeset is used as output (to screens etc.) and 
  126. 4) should wide characters or multi-byte characters be used (this
  127.    choice may be different for each of points 1-3)
  128.  
  129. For example, if portability of your files across cultural borders is
  130. an objective, you might want to use some form of Unicode encoding to
  131. achieve this.  If interaction with other tools in your environment is
  132. the main objective, and these tools use an encoding different from
  133. Unicode, this character set might be used instead.  
  134.  
  135. Using Unicode internally but writing a different format to files may
  136. sound funny (esp. if the output file format is only a subset of
  137. Unicode), but you would only have to adapt the file write and read
  138. functions and the same program will be able to execute in all
  139. countries your product might be used...)
  140.  
  141. Also, terminals and/or which process Unicode may not be available (or
  142. you might have to support legacy hardware), so you might need to adapt
  143. the output format to a third standard.
  144.  
  145.  
  146. 2. Getting your environment right for ISO 8859-X
  147. To configure your environment such that you can enter, process and
  148. display 8 bit ISO characters, check out the ISO-8859-1 FAQ available
  149. via anonymous ftp from ftp.vlsivie.tuwien.ac.at in
  150. /pub/8bit/FAQ-ISO-8859-1.  
  151.  
  152. If you use a different encoding, you will probably also have to
  153. configure your system to fully support that encoding.
  154.  
  155.  
  156.  
  157. 3. Setting your environment for ISO-C (ANSI-C) programs
  158. The ISO C Standard (ANSI C Standard 4.4) defines several functions for
  159. supporting localization. To set your international environment on
  160. program startup, you should make one or several calls to the setlocale
  161. functions.  Calls to this function will predetermine the reaction of
  162. other localization functions according to your language/country
  163. environment.
  164.  
  165. To configure a particular aspect of you environment, say the number
  166. representation, you would call
  167. --
  168. setlocale (LC_NUMERIC, "Germany");
  169. --
  170.  
  171. This call would set all number representation functions defined in the
  172. localization set to return numbers in the format used in Germany.  If
  173. the call was successful, setlocale will return the name of your
  174. locale.  A NULL return value indicates failure.  Note that the
  175. environments are predetermined outside your C program by the system
  176. you run on. (So the example given here is likely to fail on all but a
  177. few systems.) Check the setlocale manual page or your system
  178. documentation to find out about the environments available.
  179.  
  180. There are several LOCALE types available for different localization
  181. aspects (currency sign, number representation, characters sets). The
  182. value they can take is highly system dependent. Also, it should be up
  183. to the use to define the local environment he needs. 
  184.  
  185. A C program inherits its locale environment variables when it starts up.
  186. This happens automatically.  However, these variables do not
  187. automatically control the locale used by the library functions, because
  188. ISO/ANSI C says that all programs start by default in the standard C
  189. locale.  To use the locales specified by the environment, The POSIX
  190. standard defines the following call:
  191. -----
  192. setlocale (LC_ALL, "");
  193. -----
  194.  
  195. Of course, you can only set part of your environment, by calling, say:
  196. ----
  197. setlocale (LC_CTYPE, "");
  198. ----
  199. This only defines the character classification macros (defined in
  200. ctype.h).
  201.  
  202. This is a list of local categories:
  203.  
  204.                    Effect of Specifying   Environment Variable
  205.      category      the Value              Affected
  206.      __________________________________________________________
  207.  
  208.      LC_ALL        Sets or queries        LANG
  209.                    entire environment
  210.      LC_COLLATE    Changes or queries     LC_COLLATE
  211.                    collation sequences
  212.      LC_CTYPE      Changes or queries     LC_CTYPE
  213.                    character classifi-
  214.                    cation
  215.      LC_NUMERIC    Changes or queries     LC_NUMERIC
  216.                    number format infor-
  217.                    mation
  218.      LC_TIME       Changes or queries     LC_TIME
  219.                    time conversion
  220.                    parameters
  221.      LC_MONETARY   Changes or queries     LC_MONETARY
  222.                    monetary information
  223.  
  224.  
  225.  
  226.  
  227. 4. Using the locale information for character classification
  228. If you write a program which supports international use, you should
  229. use the available standardized functions, as only these will be
  230. influenced by the setlocale call. Thus, if you want to convert a
  231. capital letter in c to a lower case letter in l, _don't_ write:
  232.  
  233. l = c - 'A' + 'a';
  234.  
  235. While this will work for characters in the US-ASCII character set, it
  236. will not work with many other character sets. The following,
  237. standard-conformant code will:
  238.  
  239. #include <ctype.h>
  240.  
  241. ....
  242.  
  243. l = tolower(c);
  244.  
  245. Also note that the second code may actually be faster than even the
  246. full "C" locale functionality (for most implementations), as it
  247. replaces a complex expression ( (c<='Z' && c>='A')? c-'A'+a:c; )by a simple
  248. table lookup!
  249.  
  250. Note that this ISO standard is independent of the character set
  251. encoding used!
  252.  
  253.  
  254.  
  255. 5. Language independent messages
  256. There are two competing standards for language independent messages:
  257. one by X/Open, and another one propagated by Sun.  The X/Open standard
  258. seems to have found a larger following as it has been around for a
  259. longer time.  As of Solaris 2.x, Sun supports both the X/Open and Sun
  260. message standards.  (they used to support only their own "standard".)
  261.  
  262. 5.1 X/Open language independent messages
  263. X/Open defines a method for providing language-independent messages.
  264. Error messages are kept in a catalog which is opened upon program
  265. start with a locale specification.  Then the message number and a set
  266. specification are used to index the message catalog.  A default fourth
  267. argument is specified which will be printed if a particular message
  268. cannot be found in the catalog. 
  269.  
  270. Here is the world-famous C program using the language-independent
  271. X/Open message standard:
  272. --------------------------------------------------------------------------
  273. #include <stdio.h>
  274. #include <nl_types.h>
  275.  
  276. #define SET 1
  277. #define MSG_HELLO 1
  278.  
  279. nl_catd catfd;
  280.  
  281. int main (int argc, char **argv) {
  282.         /* Open the message catalog. We use the basename of the program
  283.          * as the catalog name. Of course, several programs can also
  284.          * share a  common catalog.
  285.          */
  286.         catfd = catopen (basename (argv [0]), NL_CAT_LOCALE);
  287.         /* catgets returns message MSG_HELLO from set SET from the 
  288.          * message catalog catfd. If catfd does not refer to a message
  289.          * catalog, or the requested message cannot be found, the
  290.          * catalog, or the requested message cannot be found, the
  291.          * fourth argument is returned.
  292.          */
  293.         printf (catgets (catfd, SET, MSG_HELLO, "hello, world\n"));
  294.         catclose (catfd);
  295.         return 0;
  296. }
  297. -------------------------------------------------------------------------
  298.  
  299. For catopen, specify the constant NL_CAT_LOCALE to open the message
  300. catalog for the locale set for the LC_MESSAGES variable; using
  301. NL_CAT_LOCALE conforms to the XPG4 standard.  You can specify 0 (zero)
  302. for compatibility with XPG3; when oflag is set to zero, the locale set
  303. for the LANG variable determines the message catalog locale.
  304.  
  305. Several utilities exist for generating message catalogs and for
  306. upgrading programs which contain hard-wired strings:
  307. * gencat is used to generate message catalogs
  308. [All other programs are OS-specific:]
  309. * Ultrix and OSF support the extract program which will extract string
  310.   constants from the C source code, and has an option to replace these
  311.   strings with calls to catgets.
  312. * HP/UX has a similar utility called findmsg.
  313. * Under OSF, message catalogs may be listed with the dspcat utility.
  314. * HP/UX calls a similar utility dumpmsg.
  315.  
  316.  
  317. 5.2 Sun/XView
  318. Sun implements a different set of functions functions to support i18n
  319. of messages (the source is available with the XView code): 
  320.  
  321. You can either use:
  322. -----------------------------------------------
  323.  
  324. main()
  325. {
  326.     // get the message catalog named "helloprogram" 
  327.     // for the hello world program
  328.     textdomain("helloprogram");    
  329.  
  330.     // get the translation for the "Hello, world\n" string
  331.     printf(gettext("Hello, world\n"));
  332. }
  333. -----------------------------------------------
  334.  
  335. or you can roll all in one and write
  336.  
  337. -----------------------------------------------
  338. main()
  339. {
  340.     // get the translation for the "Hello, world\n" string 
  341.     // from the message catalog "helloprogram"
  342.     printf(dgettext("helloprogram","Hello, world\n"));
  343. }
  344. -----------------------------------------------
  345.  
  346. The LC_MESSAGES locale category setting determines the locale of
  347. strings that gettext() returns.  The message catalogs are generated
  348. with either the installtxt or gencat commands.
  349.  
  350. No opening of files as in the old SYS V and X/Open routines, and no
  351. handling of message numbers that you must have in a database to
  352. administer.  However, this mechanism is only supported by Sun.  Sun
  353. tried to push it into COSE, but without success.
  354.  
  355.  
  356. 5.3 POSIX language independent messages
  357. Neither of the previous two mechanisms is in the POSIX standard.
  358. There was much disagreement in the POSIX.1 committee about using the
  359. gettext routines vs. catgets (XPG).  In the end the committee couldn't
  360. agree on anything, so no messaging system was included as part of the
  361. standard. I believe the informative annex of the standard includes the
  362. XPG3 messaging interfaces, "...as an example of a messaging system
  363. that has been implemented..."
  364.  
  365. They were very careful not to say anywhere that you should use one set
  366. of interfaces over the other.
  367.  
  368.  
  369.  
  370. 6. Other localization aspects in ISO/ANSI C (and POSIX environments)
  371. For a more thorough discussion of localization and
  372. internationalization (aka. i18n), check your system vendors
  373. documentation, and the C library manual which comes with the FSF's
  374. glibc library (Chapter 19, 'Locales and Internationalization').
  375.  
  376.  
  377.  
  378. 7. Internationalization under X11
  379. 7.1 Output
  380. To output text encoded with ISO 8859-1 under X11, simply invoke the X
  381. display routines with 8 bit characters as you would use them with
  382. 7-bit ASCII.  You should however choose a font which contains bitmaps
  383. for these characters.  You can use the xfd utility to display a font
  384. to verify that it contains a full set of characters.
  385.  
  386.  
  387. 7.2 Input
  388. If you use a national keyboard (that is a keyboard, which has distinct
  389. keys for your countries special characters), inputting accents is
  390. straight forward and you'll get the corresponding characters by using
  391. the X11 input functions.
  392.  
  393. Sometimes it may be necessary to input characters for which there are
  394. no keys on your keyboard (e.g. if you want to enter the German '#'
  395. from a French keyboard).  
  396.  
  397.  
  398. "X11R5 and X11R6 both have extensive support for i18n, but due to a
  399. variety of factors the R5 i18n was not well understood or widely
  400. used.  Many people resorted to a work-around and might have been
  401. disappointed when R6 did not include this feature.  It is important
  402. to recognize that the correct use of R5 and R6 i18n features will
  403. ensure maximum portability of your program." [X Consortium's view]
  404.  
  405. Unfortunately, not even the xterm terminal emulator supplied with the
  406. X11 distribution by the X Consortium supports this input method
  407. mechanism.  The lack of missing code samples (and support for this
  408. feature in some non-essential, but widely used X11 parts) may have
  409. contributed to this situation.
  410.  
  411. Footnote: Amongst other reasons, the X Consortium decision not to add
  412. support for input methods to the Xaw Athena widget contributes to this
  413. situation.  Xaw is officially not supported by the X Consortium, and
  414. thus has only marginally been improved since X11R4.  However, many
  415. users (and much of the PD software) live in an Xaw-only world, so they
  416. will not be able to benefit from this i18n effort.
  417.  
  418. X11 R5 and R6 support input methods for entering non-ASCII, and
  419. displaying and configuring text, menus etc. for a wide variety of
  420. languages.  This input method has to be installed by the application
  421. by calls to the Xlib library (or an Xt toolkit call).
  422.  
  423. [Under X11R5, some X servers (notably the Xsun server) will let you
  424. enter ISO characters by supplying a built-in escape mechanism, if no
  425. keys for these characters are on your keyboard, and will pass along
  426. and display ISO 8859-1.  This hack obviated the need to install an
  427. input method, but was less flexible.]  
  428.  
  429.  
  430. If you are using a toolkit, it is quite simple to support localization
  431. of you X11 code: 
  432. If you're using a toolkit -- Xt and a widget set like Motif or R6 Xaw --
  433. you need only add a single line of code to your source. Before any other 
  434. calls to Xt, add a call to XtSetLanguageProc, e.g.:
  435.  
  436.     int main (int argc, char** argv)
  437.     {
  438.         ...
  439.         XtSetLanguageProc (NULL, NULL, NULL);
  440.         top = XtAppInitialize ( ... );
  441.         ...
  442.     }
  443.  
  444. The LANG and LC_xxx environment variables (see section 3) will then be
  445. used to determine the 'input method' for this X application.  This
  446. input method is responsible for managing COMPOSE character sequences
  447. or any other input mechanism for this particular implementation.  Also
  448. see section 9 of ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit/FAQ-ISO-8859-1,
  449. the FAQ on ISO 8859-1 usage.
  450.  
  451.  
  452. 7.3 Toolkits, Widgets, and I18N
  453. The preferred way of inputing national characters when a national
  454. keyboard is not available is one/several input methods.  These input
  455. methods will then support various kinds of compose sequences to enter
  456. national characters.
  457.  
  458. The environment variables LANG and/or LC_xxx select the language for
  459. the Input Method (IM), but if several input methods exist, the
  460. environment variable XMODIFIERS can be used to select a specific input
  461. method.
  462.  
  463. Xlib supports IMs
  464. Xt supports IMs
  465. Xaw does not support IMs
  466.  
  467. Thus, applications written with Xlib or Xt can support IMs (see
  468. section 7.2 on how to install input methods under Xt), but Xaw based
  469. applications will not.
  470.  
  471. Motif 1.2  or greater automatically uses the R5/R6 input method APIs.
  472. Thus applications using Motif 1.2+ can be made to support IMs.
  473. Several Motif 1.[01] versions also had similar functionality added to
  474. them by the respective vendors, but these extensions are
  475. vendor-specific and not portable.
  476.  
  477. FOOTNOTE: If you can have comments/corrections for this section and on
  478.           OpenLook, please let me know.
  479.  
  480.  
  481. 7.4 I18N under X11R6, General Information
  482. Background information from the X11R6 announcement:
  483. Internationalization (also known as I18N, there being 18 letters between the
  484. i and n) of the X Window System, which was originally introduced in Release
  485. 5, has been significantly improved in R6.  The R6 I18N architecture follows
  486. that in R5, being based on the locale model used in ANSI C and POSIX, with
  487. most of the I18N capability provided by Xlib.  R5 introduced a fundamental
  488. framework for internationalized input and output.  It could enable basic
  489. localization for left-to-right, non-context sensitive, 8-bit or multi-byte
  490. codeset languages and cultural conventions.  However, it did not deal with
  491. all possible languages and cultural conventions.  R6 also does not cover all
  492. possible languages and cultural conventions, but R6 contains substantial new
  493. Xlib interfaces to support I18N enhancements, in order to enable additional
  494. language support and more practical localization.
  495.  
  496. The additional support is mainly in the area of text display.  In order to
  497. support multi-byte encodings, the concept of a FontSet was introduced in R5.
  498. In R6, Xlib enhances this concept to a more generalized notion of output
  499. methods and output contexts.  Just as input methods and input contexts sup-
  500. port complex text input, output methods and output contexts support complex
  501. and more intelligent text display, dealing not only with multiple fonts but
  502. also with context dependencies.  The result is a general framework to enable
  503. bi-directional text and context sensitive text display.
  504.  
  505. The description of the X11R6 internationalization framework is
  506. available via anonymous ftp from ftp.x.org in
  507. /pub/R6untarred/xc/doc/specs/i18n.
  508.  
  509.  
  510.  
  511. 8. Supporting I18N Network Protocols
  512. 8.1 MIME
  513. MIME is specified in RFC 1521 and RFC 1522 which are available from
  514. ftp.uu.net.  There is also a MIME FAQ which is available via anonymous
  515. ftp from ftp.ics.uci.edu in /mh/contrib/multimedia/mime-faq.txt.gz.
  516. (This file is in compressed format. You will need the GNU gunzip
  517. program to decompress this file.)
  518.  
  519. If you want to write applications which support the MIME protocol,
  520. there are several libraries/tools which can ease your task:
  521.  
  522.  
  523. 8.1.1 metamail
  524. Source for supporting MIME (the `metamail' package) in various mail
  525. readers is available via anonymous ftp from thumper.bellcore.com in
  526. /pub/nsb.  This distribution consists of several utilities, which can
  527. be called by MIME applications to handle MIME types.
  528.  
  529.  
  530. 8.1.2 MIMElt
  531. A "lightweight" MIME library available via anon ftp from
  532. oslonett.no:Software/MsDos/Comm/Offline/mimeltXX.zip 
  533.  
  534. It is source code (ANSI C) packaged as a library to facilitate
  535. construction of a limited MIME facility (limited == handling only
  536. character-set aspects of MIME, not the multimedia-aspects).  It
  537. includes hooks to recode character sets into whatever system you are
  538. running off (e.g.  if you read mail on a MsDos platform using CP-850,
  539. MIMElite may be set up so that QUOTED-PRINTABLE ISO Latin 1 is recoded
  540. into CP-850 for reading and saving to file).
  541.  
  542. It's main use is to provide programmers of so-called "off-line 
  543. readers" (used by user's who access Internet mail through dial-up 
  544. service providers) with the tools needed to include proper support for 
  545. QUOTED-PRINTABLE encoding in their product.
  546.  
  547. The archive also contain a couple of sample applications that 
  548. demonstrates how the library may be used.  UNMIME is a stand-alone 
  549. utility to decode MIME-encoded messages (e.g. it works like UUDECODE
  550. for binary files with BASE64 encoding), SENDMIME is a simple utility
  551. to send MIME-encoded messages if your service provider doesn't have
  552. PINE or similar tools.
  553.  
  554. The current version (2.1) is limited to character set issues.  I am
  555. about to release version 2.2, which will support additional 
  556. Content-Types (e.g. "application/octet-stream").
  557.  
  558.  
  559.  
  560. 9. Programming in Prolog 
  561. SICStus Prolog accepts ISO characters as part of atoms, so you can
  562. even define goal names containing accented characters.  I/O of 8 bit
  563. characters is (obviously) also supported.
  564.  
  565.  
  566.  
  567. 10. ISO 8859-1 on non-UNIX systems
  568. 10.1 MS-DOS
  569. MS-DOS generally uses its own characters set. There are several code
  570. pages (one with the same symbols as ISO 8859-1, albeit at different
  571. character code positions, which can lead to problems with the transfer
  572. of data).
  573.  
  574. If interoperability without data conversion is your goal, you can
  575. reconfigure your MS-DOS PC to use an ISO-8859-1 code page. Check out
  576. the anonymous ftp archive ftp.uni-erlangen.de, which contains data on
  577. how to do this (and other ISO-related stuff) in /pub/doc/ISO/charsets.
  578. The README file contains an index of the files you need.
  579.  
  580. Most (all?) C compilers/libraries for MS-DOS have only minimal support
  581. for the ANSI/POSIX locale mechanism.  The setlocale() and localeconv()
  582. calls (and stuff like strxfrm()) are generally hardwired.
  583.  
  584.  
  585. 10.2 MS Windows
  586. MS-Windows (using code page 1252) normally uses the first 256
  587. characters of Unicode, which is (for all practical purposes)
  588. equivalent to ISO 8859-1.  Thus, data representation and conversion
  589. for interoperability with other ISO 8859-1 compliant systems is not an
  590. issue.  
  591.  
  592. It seems that C libraries for MS Windows do not support the ANSI/POSIX
  593. locale mechanism. (If you have any experiences with that, please let
  594. me know.)  There is a POSIX-like mechanism in some Microsoft platform
  595. services, but none in the compilers from any vendor.
  596.  
  597.  
  598. 10.3 OS/2
  599. Text mode OS/2 programs generally suffer the same limitations as do
  600. MS-DOS programs, because the display hardware is the same.
  601.  
  602. Presentation Manager OS/2 programs using code page 1004 will order
  603. the font glyphs in the same sequence as ISO 8859-1 (although of
  604. course whether the glyphs will actually look anything like those
  605. from ISO 8859-1 depends entirely from the font).
  606.  
  607. The IBM CSet++ compiler supports full internationalization, with
  608. several predefined locales.
  609.  
  610. The Borland C++ compiler supports only the "C" locale.
  611.  
  612. The Watcom C++ compiler supports only the "C" locale.
  613.  
  614. The Metaware High C++ compiler supports only the "C" locale.  It
  615. does, however, also support UNICODE, providing UNICODE character
  616. types and UNICODE versions of the appropriate parts of the standard
  617. library (including I/O).
  618.  
  619.  
  620.  
  621. 10.4 Apple Macintosh
  622. MacIntoshes have their own non-standard character encodings;
  623. the first 128 characters are US-ASCII but the remaining characters are
  624. non-standard.
  625.  
  626. I do not know whether C libraries (for which compilers?) for the
  627. MacIntosh support the ANSI/POSIX locale mechanism. If you have any
  628. experiences with that, please let me know.
  629.  
  630.  
  631. 10.5 Amiga
  632. The AmigaOS uses ISO-8859-1. As of OS version 2.1, Amiga-specific
  633. means of localization are available.
  634.  
  635.  
  636.  
  637. 11. Home location of this document
  638. 11.1 www
  639. You can find this and other i18n documents under URL
  640. http://www.vlsivie.tuwien.ac.at/mike/i18n.html.
  641.  
  642. 11.2 ftp
  643. The most recent version of this document is available via anonymous
  644. ftp from ftp.vlsivie.tuwien.ac.at under the file name
  645. /pub/8bit/ISO-programming.  
  646.  
  647. -----------------
  648.  
  649. Copyright - 1994,1995 Michael Gschwind (mike@vlsivie.tuwien.ac.at)
  650.  
  651. This document may be copied for non-commercial purposes, provided this
  652. copyright notice appears.  Publication in any other form requires the
  653. author's consent. 
  654.  
  655. Dieses Dokument darf unter Angabe dieser urheberrechtlichen
  656. Bestimmungen zum Zwecke der nicht-kommerziellen Nutzung beliebig
  657. vervielfSltigt werden.  Die Publikation in jeglicher anderer Form
  658. erfordert die Zustimmung des Autors.
  659.  
  660. Michael Gschwind, Institut f. Technische Informatik, TU Wien
  661. snail: Treitlstrasse 3-182-2 || A-1040 Wien || Austria
  662. email: mike@vlsivie.tuwien.ac.at   PGP key available via www (or email)
  663. www  : URL:http://www.vlsivie.tuwien.ac.at/mike/mike.html
  664. phone: +(43)(1)58801 8156       fax: +(43)(1)586 9697
  665.